-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cksum: fix error handling #6801
Conversation
GNU testsuite comparison:
|
GNU testsuite comparison:
|
5ea3b8a
to
c9776e7
Compare
@@ -1344,3 +1344,40 @@ fn test_check_comment_leading_space() { | |||
.stdout_contains("foo: OK") | |||
.stderr_contains("WARNING: 1 line is improperly formatted"); | |||
} | |||
|
|||
#[cfg(not(windows))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/uutils/coreutils/actions/runs/11424022765/job/31783927716#step:7:3602
seems that windows has a different logic and is guarded by another test
coreutils/tests/by-util/test_cksum.rs
Lines 1195 to 1198 in 9a6f552
#[cfg(not(windows))] | |
let err_msg = "cksum: d: Is a directory\n"; | |
#[cfg(windows)] | |
let err_msg = "cksum: d: Permission denied\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please document this into the test ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
GNU testsuite comparison:
|
GNU testsuite comparison:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fixup the second and third commits into the first one, for better readability after merge.
Other than that, LGTM 👍
// if any incorrectly formatted line, show it | ||
cksum_output(&res, status); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason for moving this up ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As shown in the code snippet in #6796 :
$ ../../../gnu/src/cksum -c CHECKSUM --ignore-missing
../../../gnu/src/cksum: dir: Is a directory
dir: FAILED open or read
../../../gnu/src/cksum: WARNING: 1 listed file could not be read
../../../gnu/src/cksum: CHECKSUM: no file was verified
warnings in cksum_output
show up first, and CHECKSUM: no file was verified
shows up later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, indeed 👍
tests/by-util/test_cksum.rs
Outdated
/// Windows has a different logic and is guarded by [`test_check_directory_error`]. | ||
#[cfg(not(windows))] | ||
#[test] | ||
fn test_check_error_handling() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rename this test_check_failed_to_read
, to be a bit more specific.
47a28ed
to
d5cc3dd
Compare
Thanks @Luv-Ray and @RenjiSann ! |
fixes #6796